/**
 * Created by Administrator on 2017/8/23 0023.
 */
var LoginModule=angular.module("login",[]);
LoginModule.controller("LoginController",function ($scope,$state) {
    $scope.credentials = {
        username : '',
        password : ''
    };
    $scope.login=function (credentials) {
        if (credentials.username=="admin"){
            if ($scope.credentials.password=="123"){
                $state.go('chose');
            }
        }
    }
});

var RencaiModule=angular.module("Rencai",['tm.pagination']);
RencaiModule.controller("RencaiController",function ($scope,$http) {
    /*获取一个总表json*/
    $http({
        method:'Get',
        url: 'data/totaldata.json'
    }).then(function successsCallback(response) {
        $scope.content=response.data;
    }),function errorCallback() {
        $scope.content="error!";
    };
    /*导航点击事件*/
    $(".nav li").click(function () {
        $(".nav li").removeClass("mask");
        $(this).addClass("mask");
    });
    /*分页*/
    $scope.paginationConf = {
        currentPage: 1,
        totalItems: 500,
        itemsPerPage: 15,
        pagesLength: 15,
        perPageOptions: [10, 20, 30, 40, 50],
        onChange: function () {
        }
    }
});
RencaiModule.controller("Rencaidetail",function ($scope,$http,$state,$stateParams) {
    console.log($stateParams.id);
    $http({
        method:'Get',
        url: 'data/'+$stateParams.id+'.json'
    }).then(function successsCallback(response) {
        var content=response.data;
        var obj = angular.fromJson(content);
        $scope.content={
            name:obj.姓名,
            number:obj.学号[0],
            major:obj.专业,
            sex:obj.性别,
            homeland:obj.籍贯,
            academy:obj.院系,
            contact:obj.联系方式,
            specialSkil:obj.特长,
            internship:obj.个人实习经历,
            prize:obj.个人所得奖项,
            project:obj.项目名称,
            projectprize:obj.奖项名称,
            theory:obj.原理介绍,
            division:obj.承担分工,
            summary:obj.项目简介,
            feedback:obj.指导老师或外包负责人反馈情况,
            managerfeedback:obj.项目负责人反馈情况
        }
    }),function errorCallback() {
        $scope.content="error!";
    };
    $scope.change=function (x) {
        $scope.select=document.getElementById("projectSelect").selectedIndex;
        console.log($scope.select);
    }
});
RencaiModule.controller('upload',function($scope){
    $scope.fileChanged = function(ele){
        $scope.files = ele.files;
        $scope.$apply();
    }

    $scope.upload = function(){
        console.log($scope.files);
    }
});